/**
 * Yolema.com Inc.
 * Copyright (c) 2011-2012 All Rights Reserved.
 */
package org.grayrabbit.pay.core.action.interceptors;

import org.grayrabbit.pay.core.model.common.SystemConstants;
import org.grayrabbit.web.struts2.Struts2Utils;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 登录拦截器
 * 
 * @author wy
 * @version $Id: LoginInterceptors.java, v 0.1 2012-6-12 下午1:57:45 wy Exp $
 */
public class LoginInterceptor extends AbstractInterceptor{

    /** serialVersionUID */
    private static final long serialVersionUID = -6623737423848561889L;

    /** 
     * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
     */
    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        
        Object username = Struts2Utils.getSession().getAttribute(SystemConstants.SESSION_ADMIN);
        
        if(null!=username){
            return invocation.invoke();
        }
        
        return "notlogin";
    }

}
